﻿@inherits Microsoft.VisualStudio.Web.CodeGeneration.Templating.RazorTemplateBase
@using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
@{
    var minUsings = new HashSet<string>()
    {
         "System",
         "System.Collections.Generic",
         "System.Linq",
         "System.Threading.Tasks",
         "Microsoft.EntityFrameworkCore"

    };
    foreach (var namespaceName in Model.RequiredNamespaces)
    {
        if (!minUsings.Contains(namespaceName))
        {
@:using @namespaceName;
        }
    }
@:
    string baseClassName;
    if (String.Equals(Model.DbContextTypeName, "DbContext", StringComparison.Ordinal))
    {
        baseClassName = "Microsoft.EntityFrameworkCore.DbContext";
    }
    else
    {
        baseClassName = "DbContext";
    }
    if (!String.IsNullOrEmpty(Model.DbContextNamespace))
    {
@:namespace @Model.DbContextNamespace
@:{
    //PushIndent("    ");
    } 
}    public class @Model.DbContextTypeName : @baseClassName
    {
        public @Model.DbContextTypeName (DbContextOptions<@Model.DbContextTypeName> options)
            : base(options)
        {
        }

        public DbSet<@Model.ModelTypeFullName> @Model.ModelTypeName { get; set; }
    }
@{
    if (!String.IsNullOrEmpty(Model.DbContextNamespace))
    { 
        //ClearIndent();
@:}
    }
}